//停车记录 - 静态 路由
import { http } from "@/utils/http";
import { baseUrlApi } from "@/api/utils";
import type { ResultTable } from "@/api/result/result_table";

const basePath = "system/user";

//管理员列表
export const getUserList = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + ""), {
    data
  });
};

//新增管理员
export const addUser = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/add"), {
    data
  });
};

//修改管理员
export const updateUser = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/update"), {
    data
  });
};

//删除管理员
export const delUser = (data?: object) => {
  return http.request<ResultTable>("post", baseUrlApi(basePath + "/delete"), {
    data
  });
};

//更新状态
export const updateUserStatus = (data?: object) => {
  return http.request<ResultTable>(
    "post",
    baseUrlApi(basePath + "/update_status"),
    {
      data
    }
  );
};

type Result = {
  success: boolean;
  data?: boolean;
  message?: string;
};
// 判断是否为超级管理员
export const getIsSuperAdmin = (params?: object) => {
  return http.request<Result>("get", baseUrlApi(basePath + "/is_super_admin"), {
    params
  });
};
